<template>
  <div>
    <el-dialog
      v-model="dialogVisible"
      title="Tips"
      width="30%"
      :before-close="handleClose"
      :modal="true"
    >
      <span>您确定要删除这条数据 ?</span>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="deleteSpecs"> 确定 </el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup lang="ts">
import {
  ref,
  reactive,
  toRefs,
  watch,
  onMounted,
  getCurrentInstance,
} from 'vue'
import * as Api from '@/api/goods/admin-attribute'
import { useRouter } from 'vue-router'
import { objectEntries, useVModels } from '@vueuse/core'
import { ElMessageBox } from 'element-plus'

//const { } = toRefs(props);

const router = useRouter()

const emit = defineEmits(['update:dialogVisible', 'refreshTable'])
const props = defineProps({
  dialogVisible: {
    type: Boolean,
    default: false,
  },
  attId: {
    type: Number,
    default: -1,
  },
})
const { dialogVisible } = useVModels(props)
const { attId } = toRefs(props)

const deleteSpecs = async () => {
  await Api.deleteAttributeSpecs(attId.value)
  dialogVisible.value = false
  emit('refreshTable')
}

const handleClose = (done: () => void) => {
  done()
}

const { data } = toRefs(
  reactive({
    //定义数组和对象
    data: '',
  })
)
</script>
<style lang="scss" scoped></style>
